#include <QDebug>

#include "painttool.h"
#include <QGraphicsSceneMouseEvent>

PaintTool::PaintTool()
{

}

PaintTool::~PaintTool()
{

}

QString PaintTool::toolKey()
{
    return "";
}

QString PaintTool::infoText()
{
    return displayText();
}

QString PaintTool::displayText()
{
    return "Tool";
}

void PaintTool::mouseReleased(QGraphicsSceneMouseEvent *e)
{
    recordMouseActivity(e, PaintTool::MouseReleased);
}

void PaintTool::mousePressed(QGraphicsSceneMouseEvent *e)
{
    recordMouseActivity(e, PaintTool::MousePressed);
}

void PaintTool::mouseMoved(QGraphicsSceneMouseEvent *e)
{
    recordMouseActivity(e, PaintTool::MouseMove);
}

void PaintTool::recordMouseActivity(QGraphicsSceneMouseEvent *e, PaintTool::MouseActivity activity)
{
    //qDebug() << e->scenePos().x() << "," << e->scenePos().y();
    int x = e->scenePos().x();
    int y = e->scenePos().y();
    switch(activity)
    {
    case PaintTool::MousePressed:
        mouseDown = true;
        downX = x;
        downY = y;
        break;
    case PaintTool::MouseReleased:
        mouseDown = false;
        upX = x;
        upY = y;
        break;
    case PaintTool::MouseMove:
        curX = x;
        curY = y;
        break;
    }
}
